package com.appkubes.mall.restful.application.demo.event;

import com.appkubes.mall.restful.event.demo.DemoEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Repository;

/**
 * @Author: Rongjie
 * @Date: 2020/3/6
 * @Description:
 */
@Repository
@Slf4j
public class DemoEventHandleImpl implements DemoEventHandle {

    @EventListener
    @Async
    void demo(DemoEvent eventHandle) {
        log.info("event demo: {}", eventHandle);
        try {
            Thread.sleep(10000L);
            log.info("ok");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


    }
}
